# -*- encoding:utf-8 -*-
from mako import runtime, filters, cache
UNDEFINED = runtime.UNDEFINED
__M_dict_builtin = dict
__M_locals_builtin = locals
_magic_number = 5
_modified_time = 1284612073.793638
_template_filename=u'/Users/joeldunham/old/onlinelinguisticdatabase/templates/base/exporter.html'
_template_uri=u'/base/exporter.html'
_template_cache=cache.Cache(__name__, _modified_time)
_source_encoding='utf-8'
from webhelpers.html import escape
_exports = ['exportByType', 't_mb_mg_g', 't_g', 'all', 't']


def render_body(context,**pageargs):
    context.caller_stack._push_frame()
    try:
        __M_locals = __M_dict_builtin(pageargs=pageargs)
        self = context.get('self', UNDEFINED)
        c = context.get('c', UNDEFINED)
        __M_writer = context.writer()
        # SOURCE LINE 1
        __M_writer(escape(self.exportByType(c.exportType)))
        __M_writer(u'\n\n')
        # SOURCE LINE 17
        __M_writer(u'\n\n\n')
        # SOURCE LINE 25
        __M_writer(u'\n\n\n')
        # SOURCE LINE 39
        __M_writer(u'\n\n\n')
        # SOURCE LINE 44
        __M_writer(u'\n\n\n')
        # SOURCE LINE 95
        __M_writer(u'\n\n')
        return ''
    finally:
        context.caller_stack._pop_frame()


def render_exportByType(context,exportType):
    context.caller_stack._push_frame()
    try:
        c = context.get('c', UNDEFINED)
        self = context.get('self', UNDEFINED)
        __M_writer = context.writer()
        # SOURCE LINE 3
        __M_writer(u'\n<pre>')
        # SOURCE LINE 5
        for form in c.forms:
            # SOURCE LINE 6
            if exportType == 't_g':
                # SOURCE LINE 7
                __M_writer(escape(self.t_g(form)))
                __M_writer(u'            \n')
                # SOURCE LINE 8
            elif exportType == 't_mb_mg_g':
                # SOURCE LINE 9
                __M_writer(escape(self.t_mb_mg_g(form)))
                __M_writer(u'\n')
                # SOURCE LINE 10
            elif exportType == 't':
                # SOURCE LINE 11
                __M_writer(escape(self.t(form)))
                __M_writer(u'\n')
                # SOURCE LINE 12
            elif exportType == 'all':
                # SOURCE LINE 13
                __M_writer(escape(self.all(form)))
                __M_writer(u'\n')
                pass
            pass
        # SOURCE LINE 16
        __M_writer(u'</pre>')
        return ''
    finally:
        context.caller_stack._pop_frame()


def render_t_mb_mg_g(context,form):
    context.caller_stack._push_frame()
    try:
        __M_writer = context.writer()
        # SOURCE LINE 28
        __M_writer(u'\n')
        # SOURCE LINE 29
        __M_writer(escape(form.grammaticality))
        __M_writer(escape(form.transcription))
        __M_writer(u'\n')
        # SOURCE LINE 30
        if form.morphemeBreak:
            # SOURCE LINE 31
            __M_writer(escape(form.morphemeBreak))
            __M_writer(u'\n')
            pass
        # SOURCE LINE 33
        if form.morphemeGloss:
            # SOURCE LINE 34
            __M_writer(escape(form.morphemeGloss))
            __M_writer(u'\n')
            pass
        # SOURCE LINE 36
        for gloss in form.glosses:
            # SOURCE LINE 37
            __M_writer(escape(gloss.glossGrammaticality))
            __M_writer(escape(gloss.gloss))
            __M_writer(u'\n')
            pass
        return ''
    finally:
        context.caller_stack._pop_frame()


def render_t_g(context,form):
    context.caller_stack._push_frame()
    try:
        __M_writer = context.writer()
        # SOURCE LINE 20
        __M_writer(u'\n')
        # SOURCE LINE 21
        __M_writer(escape(form.grammaticality))
        __M_writer(escape(form.transcription))
        __M_writer(u'\n')
        # SOURCE LINE 22
        for gloss in form.glosses:
            # SOURCE LINE 23
            __M_writer(escape(gloss.glossGrammaticality))
            __M_writer(escape(gloss.gloss))
            __M_writer(u'\n')
            pass
        return ''
    finally:
        context.caller_stack._pop_frame()


def render_all(context,form):
    context.caller_stack._push_frame()
    try:
        keyword = context.get('keyword', UNDEFINED)
        __M_writer = context.writer()
        # SOURCE LINE 47
        __M_writer(u'\n')
        # SOURCE LINE 48
        __M_writer(escape(form.grammaticality))
        __M_writer(escape(form.transcription))
        __M_writer(u'\n')
        # SOURCE LINE 49
        if form.morphemeBreak:
            # SOURCE LINE 50
            __M_writer(escape(form.morphemeBreak))
            __M_writer(u'\n')
            pass
        # SOURCE LINE 52
        if form.morphemeGloss:
            # SOURCE LINE 53
            __M_writer(escape(form.morphemeGloss))
            __M_writer(u'\n')
            pass
        # SOURCE LINE 55
        for gloss in form.glosses:
            # SOURCE LINE 56
            __M_writer(escape(gloss.glossGrammaticality))
            __M_writer(escape(gloss.gloss))
            __M_writer(u'\n')
            pass
        # SOURCE LINE 58
        __M_writer(u'\nID: ')
        # SOURCE LINE 59
        __M_writer(escape(form.id))
        __M_writer(u'\n')
        # SOURCE LINE 60
        if form.comments:
            # SOURCE LINE 61
            __M_writer(u'comments: ')
            __M_writer(escape(form.comments.replace('\n', '')))
            __M_writer(u'\n')
            pass
        # SOURCE LINE 63
        if form.speakerComments:
            # SOURCE LINE 64
            __M_writer(u'speaker comments: ')
            __M_writer(escape(form.speakerComments.replace('\n', '')))
            __M_writer(u'\n')
            pass
        # SOURCE LINE 66
        if form.speaker:
            # SOURCE LINE 67
            __M_writer(u'speaker: ')
            __M_writer(escape(form.speaker.firstName))
            __M_writer(u' ')
            __M_writer(escape(form.speaker.lastName))
            __M_writer(u'\n')
            pass
        # SOURCE LINE 69
        if form.elicitor:
            # SOURCE LINE 70
            __M_writer(u'elicitor: ')
            __M_writer(escape(form.elicitor.firstName))
            __M_writer(u' ')
            __M_writer(escape(form.elicitor.lastName))
            __M_writer(u'\n')
            pass
        # SOURCE LINE 72
        if form.verifier:
            # SOURCE LINE 73
            __M_writer(u'verifier: ')
            __M_writer(escape(form.verifier.firstName))
            __M_writer(u' ')
            __M_writer(escape(form.verifier.lastName))
            __M_writer(u'\n')
            pass
        # SOURCE LINE 75
        if form.enterer:
            # SOURCE LINE 76
            __M_writer(u'enterer: ')
            __M_writer(escape(form.enterer.firstName))
            __M_writer(u' ')
            __M_writer(escape(form.enterer.lastName))
            __M_writer(u'\n')
            pass
        # SOURCE LINE 78
        if form.source:
            # SOURCE LINE 79
            __M_writer(u'source: ')
            __M_writer(escape(form.source.authorLastName))
            __M_writer(u' (')
            __M_writer(escape(form.source.year))
            __M_writer(u')\n')
            pass
        # SOURCE LINE 81
        if form.dateElicited:
            # SOURCE LINE 82
            __M_writer(u'date elicited: ')
            __M_writer(escape(form.dateElicited.strftime('%b %d, %Y')))
            __M_writer(u'\n')
            pass
        # SOURCE LINE 84
        __M_writer(u'date entered: ')
        __M_writer(escape(form.datetimeEntered.strftime('%b %d, %Y at %I:%M %p')))
        __M_writer(u'\ndate updated: ')
        # SOURCE LINE 85
        __M_writer(escape(form.datetimeModified.strftime('%b %d, %Y at %I:%M %p')))
        __M_writer(u'\n')
        # SOURCE LINE 86
        if form.elicitationMethod:
            # SOURCE LINE 87
            __M_writer(u'elicitation method: ')
            __M_writer(escape(form.elicitationMethod.name))
            __M_writer(u'\n')
            pass
        # SOURCE LINE 89
        if form.syntacticCategory:
            # SOURCE LINE 90
            __M_writer(u'syntactic category: ')
            __M_writer(escape(form.syntacticCategory.name))
            __M_writer(u'\n')
            pass
        # SOURCE LINE 92
        if form.keywords:
            # SOURCE LINE 93
            __M_writer(u'keywords: ')
            __M_writer(escape(', '.join([keyword.name for keyword in form.keywords])))
            __M_writer(u'\n')
            pass
        return ''
    finally:
        context.caller_stack._pop_frame()


def render_t(context,form):
    context.caller_stack._push_frame()
    try:
        __M_writer = context.writer()
        # SOURCE LINE 42
        __M_writer(u'\n')
        # SOURCE LINE 43
        __M_writer(escape(form.grammaticality))
        __M_writer(escape(form.transcription))
        __M_writer(u'\n')
        return ''
    finally:
        context.caller_stack._pop_frame()


